let r = 6371.0
let pi = 4.0 *. atan 1.0
type coord = {lat:float;long:float}
let origin = {lat=0.0;long=0.0}

(* first things first. need to get a coord that will represent two
points on a map in (latitute,longitude) float form 
let point1 = {lat=50.066175;long=(-5.714607)}
let point2 = {lat=58.640129;long=(-3.07379)}
*)

class point =
object
  val mutable long = 0.0
  val mutable lat = 0.0
  method get_long = long
  method get_lat = lat
  method set_long set = long <- set
  method set_lat set = lat <- set
end

(*distance using Spherical Law of Cosines*)
let distance = (acos ((sin (point1.lat *. pi /. 180.0))*.(sin (point2.lat*. pi /. 180.0))+.(cos (point1.lat*. pi /. 180.0))*.(cos (point2.lat *. pi /. 180.0))*.(cos ((point2.long*. pi /. 180.0)-.(point1.long*. pi /. 180.0))))) *. r;;

Printf.printf "%f kilometers \n" distance (* Sys.argv.(1) *)
